﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Srvtools;
using System.Data;

public partial class WorkTimeN_ToneOffList : System.Web.UI.UserControl
{
    private Srvtools.WebDataSet WMaster;
    private string _EmployeeId;

    public string EmployeeId
    {
        get
        {
            return _EmployeeId;
        }
        set
        {
            _EmployeeId = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
         
            ReLoad();
        }

    }

    public void ReLoad()
    {
        InitializeComponent();
        Master.DataSource = WMaster;
        if (_EmployeeId == null || _EmployeeId == "")
        {
            _EmployeeId = "0";
        }
        Master.SetWhere("WorkTime_OverTime2Rest.EmployeeId= " + _EmployeeId);
        wgvMaster.DataBind();

        object[] objParam = new object[1];
        objParam[0] = _EmployeeId;
        //GetSumDaysOfRest
        object[] myRet = CliUtils.CallMethod("SWorkTime", "GetSumDaysOfRest", objParam);
        if (myRet != null)
        {
            double m = (myRet[1] != DBNull.Value && myRet[1] != null ? Convert.ToDouble(myRet[1]) : 0);
            Label1.Text = "工号-" + _EmployeeId + ": 总共可用调休为 <span style='color:red; font-weight:bold;font-size:20px;'>" + m + "</span> 小时";

            Label1.NavigateUrl = "ToneOffList.aspx?Eid=" + _EmployeeId + "&red=" + Server.UrlEncode(Request.Url.ToString());
        }
    }

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WorkTimeN_ToneOffList));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = true;
        this.WMaster.AlwaysClose = false;
        this.WMaster.DeleteIncomplete = true;
        this.WMaster.Guid = null;
        this.WMaster.LastKeyValues = null;
        this.WMaster.PacketRecords = 100;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = "SWorkTime.ViewWorkTime_OverTime2Rest";
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();

    }
}
